RAIS  3.2
C:/Projekte/RAIS/Specific Masks/MessageBoxHistory.aspx.cs
Go to the documentation of this file.
00001 using System;
00002 using System.Collections.Generic;
00003 using System.Linq;
00004 using System.Web;
00005 using System.Web.UI;
00006 using System.Web.UI.WebControls;
00007 using RAIS.Common.UserManagement;
00008 
00009 namespace RAIS.UI.SpecificMasks
00010 {
00011     public partial class MessageBoxHistory : System.Web.UI.Page
00012     {
00013 
00014         #region event handlers
00015         protected void Page_Load(object sender, EventArgs e)
00016         {
00017             if (this.CurrentUser == null)
00018                 UI.Common.AccessManagement.SignOut(this);
00019 
00020             if (!this.IsPostBack)
00021             {
00022                 this.LBLusernameNoTranslation.Text = this.CurrentUser.Login;
00023 
00024                 //this.Session[RAIS.UI.Common.Constants.SELECTED_USER_TAG] = null;
00025                 //this.TBSelectedUser.Text = "";
00026 
00027 
00028                 //foreach (DataControlField gridColumn in this.GVuserpermissions.Columns)
00029                 //{
00030                 //    gridColumn.HeaderText = RAIS.ApplicationLogicLayer.Localisation.Translate(gridColumn.HeaderText
00031                 //        , this.ToString()
00032                 //        , RAIS.Common.Constants.DEFAULT_LANGUAGE
00033                 //        , this.CurrentUser.Language);
00034                 //}
00035 
00036                 UI.Common.Localisation.TranslateGridViewHeader(this.GVuserpermissions, this.ToString(), RAIS.Common.Constants.DEFAULT_LANGUAGE, this.CurrentUser.Language);
00037                 UI.Common.Localisation.TranslateGridViewHeader(this.GVUserAssignments, this.ToString(), RAIS.Common.Constants.DEFAULT_LANGUAGE, this.CurrentUser.Language);
00038 
00039                 this.LBLmessage.ForeColor = RAIS.UI.Common.Constants.COLOR_OF_MENU_BAR_TEXT_HIGHLIGHT;
00040                 UI.Common.PageManagement.InitializePage(this, this.TreeView1);
00041 
00042                 //UI.Common.UserManagement.InitializeCustomUsersListBox(this.LBselecteduser, UI.Common.UserManagement.GetLevelThreeUsers().Values.ToList<UserData>());
00043                 this.DDLSelectedUser.DataSource = UI.Common.UserManagement.GetLevelThreeUsers().Values.ToList<UserData>();
00044                 this.DDLSelectedUser.DataBind();
00045 
00046                 if (this.DDLSelectedUser.Items.Count >= 0)
00047                 {
00048                     if (this.Session[RAIS.UI.Common.Constants.SELECTED_USER_TAG] != null)
00049                     {
00050                         //this.TBSelectedUser.Text = ((UserData)this.Session[RAIS.UI.Common.Constants.SELECTED_USER_TAG]).Login;
00051                         //this.LBselecteduser.SelectedValue = this.TBSelectedUser.Text;
00052                         this.DDLSelectedUser.SelectedValue = ((UserData)this.Session[RAIS.UI.Common.Constants.SELECTED_USER_TAG]).Login;
00053                     }
00054                     else
00055                     {
00056                         //this.LBselecteduser.SelectedIndex = 0;
00057                         //this.TBSelectedUser.Text = this.LBselecteduser.SelectedValue;
00058                         this.DDLSelectedUser.SelectedIndex = 0;
00059                     }
00060 
00061                     if (this.UserHistory != null)
00062                     {
00063                         initGrids();
00064                     }
00065                     else
00066                     {
00067                         this.GVuserpermissions.DataSource = new List<MessageBoxRestriction>();
00068                         this.GVuserpermissions.DataBind();
00069 
00070                         this.GVUserAssignments.DataSource = new List<MessageBoxRestriction>();
00071                         this.GVUserAssignments.DataBind();
00072                     }
00073                     this.GVuserpermissions.SelectedIndex = -1;
00074                     this.GVUserAssignments.SelectedIndex = -1;
00075                 }
00076                 else
00077                 {
00078                     //this.LBselecteduser.SelectedIndex = -1;
00079                     this.DDLSelectedUser.SelectedIndex = -1;
00080                 }
00081                 
00082             }
00083             //this.TBFromDate.Text = "";
00084             //this.TBToDate.Text = "";
00085 
00086             //UI.Common.Localisation.TranslatePage(this);
00087             UI.Common.PageManagement.InitHelpMainMenu(LBTNdefault);
00088         
00089         }
00090 
00091         protected void DDLSelectedUser_SelectedIndexChanged(object sender, EventArgs e)
00092         {
00093             if (this.UserHistory != null)
00094             {
00095                 this.initGrids();
00096             }
00097             else
00098             {
00099                 this.GVuserpermissions.DataSource = new List<MessageBoxRestriction>();
00100                 this.GVuserpermissions.DataBind();
00101             }
00102         }
00103 
00110         protected void LBTNlogout_Click(object sender, EventArgs e)
00111         {
00112             UI.Common.AccessManagement.SignOut(this);
00113         }
00120         protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
00121         {
00122             UI.Common.UserManagement.ProcessTreeViewOnRedirect(this.TreeView1);
00123         }
00124 
00125 
00132         protected void GVuserpermissions_RowCommand(object sender, GridViewCommandEventArgs e)
00133         {
00134             //this.GVuserpermissions.DataSource = this.UserHistory;
00135             if (e.CommandName.Equals("Select"))
00136             {
00137                 int rowIndex = Convert.ToInt32(e.CommandArgument);
00138                 this.GVuserpermissions.SelectedIndex = rowIndex;
00139                 //this.EnableDisableControls();
00140             }
00141         }
00142 
00143         protected void GVUserAssignments_RowCommand(object sender, GridViewCommandEventArgs e)
00144         {
00145             //this.GVuserpermissions.DataSource = this.UserHistory;
00146             if (e.CommandName.Equals("Select"))
00147             {
00148                 int rowIndex = Convert.ToInt32(e.CommandArgument);
00149                 this.GVUserAssignments.SelectedIndex = rowIndex;
00150                 //this.EnableDisableControls();
00151             }
00152         }
00153 
00154         #endregion
00155 
00156         #region private helper methods
00157         private void initGrids()
00158         {
00159             this.GVuserpermissions.DataSource = this.UserHistory;
00160             this.GVuserpermissions.DataBind();
00161 
00162             this.GVUserAssignments.DataSource = this.UserAssignmentHistory;
00163             this.GVUserAssignments.DataBind();
00164         }
00165 
00166         #endregion
00167 
00168         #region Fields
00169 
00170         public List<MessageBoxRestriction> UserHistory
00171         {
00172             get
00173             {
00174                 //UserData user = (UserData)this.Session[RAIS.UI.Common.Constants.SELECTED_USER_TAG];
00175                 UserData user = this.selectedUser;
00176                 string returnMessage = "";
00177                 return RAIS.UI.Common.UserManagement.MessageboxRestrictionHistoryForUser(user, ref returnMessage);
00178             }
00179 
00180         }
00181 
00182         public List<UserAssignment> UserAssignmentHistory
00183         {
00184             get
00185             {
00186                 return ApplicationLogicLayer.UserManagement.GetUserAssignmentHistoryForUser(this.selectedUser);
00187             }
00188         }
00189 
00190         public UserData selectedUser
00191         {
00192             get
00193             {
00194                 try
00195                 {
00196                     UserData userData = ApplicationLogicLayer.UserManagement.GetUserData(this.DDLSelectedUser.SelectedValue);
00197                     this.Session[RAIS.UI.Common.Constants.SELECTED_USER_TAG_HISTORY] = userData;
00198                     this.Session[RAIS.UI.Common.Constants.SELECTED_USER_TAG] = userData;
00199                     return userData;
00200                 }
00201                 catch (Exception)
00202                 {
00203                     return null;
00204                 }
00205             }
00206         }
00207 
00208         protected UserData CurrentUser
00209         {
00210             get { return (UserData)this.Session[UI.Common.Constants.CURRENT_USER_TAG]; }
00211         }
00212 
00213         #endregion
00214     }
00215 }